import hasPermission from './hasPermission'

const install = function(Vue) {
  Vue.directive('hasPermission', hasPermission)
}

if (window.Vue) {
  window['hasPermission'] = hasPermission
  Vue.use(install); // eslint-disable-line
}

hasPermission.install = install
export default hasPermission


/**
 * 自定义指令使用示例
  <template>
    <!-- Admin can see this -->
    <el-tag v-has-permission="['admin']">admin</el-tag>

    <!-- Editor can see this -->
    <el-tag v-has-permission="['editor']">editor</el-tag>

    <!-- Editor can see this -->
    <el-tag v-has-permission="['admin','editor']">Both admin or editor can see this</el-tag>
  </template>

  <script>
    // 当然你也可以为了方便使用，将它注册到全局，注册成全局指令后，就不用每次使用前都引用声明一下了，hasPermission就已经在main.js里注册到全局了
    import permission from '@/directive/permission/index.js' // 权限判断指令
    export default{
      directives: { permission }
    }
  </script>
 **/
